int max_elememt(int x[], int n)
{
    int index = 0;
    int max = x[0];
    for (int i = 1; i < n; i++)
    {
        if (max < x[i])
        {
            max = x[i];
            index = i;
        }
    }
    return index;
}